﻿/**
 *	\file		lxpref_fac.cxx
 *	\date		(2015-01-01 00:38:39)/(2015-01-01 00:38:39)
 *-----------------------------------------------------------------------------
 *	\brief
 *	\version	1.0.0.1
 *	\author		Nick Shallery	(nicknide@gmail.com)
 *	\copyright	YOU HAVE ALL LEFT WITH THIS CODE WHILE YOU KEEP COMMENT IN EVERY COPY.
 *-----------------------------------------------------------------------------
**/

#include	"./lxpref_fac.hxx"

#include	"./lxprofile.hxx"
#include	"./lxpref_route.hxx"
#include	"./lxpref_route_end.hxx"

#include	"../lxsamsara/recurrence.h"


#include	<lolix/loli/critical_section.h>
#include	<lxut/ctrl/ctrl_string.h>
#include	<lxnet/lxnet_itf.h>
#include	<lolix/toy/stdc_fun.h>

lxpref::_inst::lxpref_fac_inst::~lxpref_fac_inst(void)
{
	this->_recur->release();
	this->_alc->release();
	this->_async_pool_fac->release();
	this->_cs_fac->release();
	this->_ctrl_str_fac->release();
	this->_net_fac->release();
	this->_ref_fac->release();
	this->_sig_fac->release();
	this->_stdc->release();
	this->_td_fac->release();
	this->_tinf->release();
}


lolix::LOLIX_RETNV
lxpref::_inst::lxpref_fac_inst::create_inst(this_type** out_ptr, lolix::dynamic_allocator* alc
			, lxio::file_async_pool_factory* async_pool_fac
			, lolix::ref_factory* ref_fac
			, lxnet::net_factory* net_fac
			, lolix::toy::stdc_fun* stdc
			, lolix::loli::signal::factory_type* sig_fac
			, lolix::loli::critical_section_factory* cs_fac
			, lxut::ctrl::ctrl_string_factory* ctrl_str_fac
			, lolix::toy::time_info* tinf
			, lolix::loli::thread_factory* td_fac
			, lxsamsara::recurrence* recur
			)
{
	this_type* ptr;
	LOLIX_RETNV rtv;
	if ( LOLIX_CHECK_ERROR(rtv = __Create_inst_set_alc(&ptr, alc, ref_fac)) )
		return rtv;
	(ptr->_async_pool_fac = async_pool_fac)->inc_ref();
	(ptr->_cs_fac = cs_fac)->inc_ref();
	(ptr->_ctrl_str_fac = ctrl_str_fac)->inc_ref();
	(ptr->_net_fac = net_fac)->inc_ref();
	(ptr->_ref_fac = ref_fac)->inc_ref();
	(ptr->_sig_fac = sig_fac)->inc_ref();
	(ptr->_stdc = stdc)->inc_ref();
	(ptr->_td_fac = td_fac)->inc_ref();
	(ptr->_tinf = tinf)->inc_ref();
	(ptr->_recur = recur)->inc_ref();
	*out_ptr = ptr;
	return lolix::LOLIX_RETNV_OK;
}


lolix::LOLIX_RETNV
lxpref::_inst::lxpref_fac_inst::create_inst(lxprofile** out_ptr)
{
	return lxprofile_inst::create_inst((lxprofile_inst**)out_ptr, _alc, _ref_fac, _tinf, _cs_fac, _sig_fac, _td_fac);
}


lolix::LOLIX_RETNV
lxpref::_inst::lxpref_fac_inst::create_inst(lxpref_route** out_ptr, lxprofile* prof)
{
	return lxpref_route_inst::create_inst((lxpref_route_inst**)out_ptr, _alc, _ref_fac, prof, _cs_fac, _td_fac, _net_fac, _stdc, _recur, _async_pool_fac);
}


lolix::LOLIX_RETNV
lxpref::_inst::lxpref_fac_inst::create_inst(lxpref_route_end** out_ptr, lolix::lx_wchar const* path, lolix::size_type path_len, lxio::file_async_pool* async_pool)
{
	return lxpref_route_end_inst::create_inst((lxpref_route_end_inst**)out_ptr, _alc, _ref_fac, _net_fac, _stdc, _recur, _sig_fac, _cs_fac, _ctrl_str_fac, path, path_len, async_pool);
}

